package org.cangku.controller;

import org.cangku.dao.XsTongJiDao;
import org.cangku.pojo.MemberSex;
import org.cangku.pojo.Membertongji;
import org.cangku.pojo.RiQiTongji;
import org.cangku.pojo.Xstongji;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/tongji")
public class TongJiController {
    @Autowired
    private XsTongJiDao xsTongJiDao;
    /*商品销量统计*/
    @RequestMapping("/query")
    @ResponseBody
    public Map<String,Object> query(){
        Map<String,Object> map = new HashMap<String, Object>();

        List<Xstongji> xslist =  xsTongJiDao.query();
        map.put("xslist",xslist);
        return map;
    }

    /*会员使用性别统计*/
    @RequestMapping("/membersex")
    @ResponseBody
    public List<MemberSex> memberSex(){
        return xsTongJiDao.memberSex();
    }

    /*会员类型统计*/
    @RequestMapping("/membertongji")
    @ResponseBody
    public List<Membertongji> membertongji(){
        return xsTongJiDao.tjmember();
    }

    /*每天的消费折线图*/
    @RequestMapping("/riqiquery")
    @ResponseBody
    public List<RiQiTongji> riqiquery(){
        return xsTongJiDao.riqiQuery();
    }
}
